package cn.itsource.ymcc.client;

import cn.itsource.ymcc.domain.Logininfo;
import cn.itsource.ymcc.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class LogininfoClientFallbackFactory implements FallbackFactory<LogininfoClient> {
    @Override
    public LogininfoClient create(Throwable throwable) {
        return new LogininfoClient() {
            @Override
            public JsonResult saveOrUpdate(Logininfo logininfo) {
                throwable.printStackTrace();
                return JsonResult.error("调用登录服务失败:"+throwable.getMessage());
            }
        };
    }
}
